package org.example.enjoy.enjoyByThread;

import org.example.enjoy.SignInfo;
import org.example.enjoy.SignInfo4Pool;

import java.util.HashMap;

public class SignInfoFactory {

    //池容器
    private static HashMap<String, SignInfo> pool = new HashMap();

    //从池中获取对象
    public static SignInfo getSignInfo(String key){
        //设置返回对象
        SignInfo result;
        if (!pool.containsKey(key)){
            result=new SignInfo();
            pool.put(key,result);
        }else {
            result = pool.get(key);
        }
        return result;
    }
}
